<?php

namespace App\Http\Controllers\Demo;

use DB;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
class HelloController extends Controller
{
    public function index(Request $request)
    {


        if($request->isMethod('post'))
        {
            $resource=$request->all();
            return json_encode($resource);
        }else{
            $t1O=DB::table('t1');
            $res=$t1O->get();
            $user=$t1O->paginate(2);
            //var_dump($user);
            /*$data=['username'=>'haha','age'=>22];*/
            /*print_r($data);*/
            return view('demo.table',['res'=>$res,'user'=>$user]);
        }

    }
}